#ifndef LOCALCAPTURE_H
#define LOCALCAPTURE_H

#include "libpfcmu/capture++.h"
#include "libpfcmu/util.h"

class LocalCapture
{
public:
    LocalCapture(const char *host, unsigned int fps = 25,
                 unsigned int camera=0, double shutter = 30.0, double gain = 30.0);

    void run(unsigned int c_ringnum = 8);

    timestamp_t startCapture(timestamp_t start, unsigned int n, std::string fname = "/data/oneshot.raw", unsigned int d_ringnum = 8);
    timestamp_t startCapture(unsigned int n, std::string fname = "/data/oneshot.raw", unsigned int d_ringnum = 8);

    PF_EZImage *getLiveImg();
    void setShutter(double shutter);
    void setGain(double gain);

    bool checkRunning() const;
    unsigned int getFps() const;

private:
    //PFCMU::Capture capture;
    const char *HOSTNAME;
    bool isRunning, isInit, isCapturing;
    PF_EZImage *currImg, *prevImg;

    unsigned int m_Fps, m_CameraArrayIdx, m_CRingNum, m_DRingNum;
    double m_Shutter, m_Gain;
    const int FRAMEINC;

    timestamp_t m_StartTimeCode;
    timestamp_t ts_curr,ts_prev;
    unsigned int m_Frames;
    std::string m_OutFName;

    void localRun(unsigned int fps, unsigned int c_ringnum, unsigned int camera);
};

#endif // LOCALCAPTURE_H
